<template>
	<view class="zone">
		<Header title="我的收货地址" color="#fff"></Header>
		<view class="main">
			<view class="list">
				<view class="item" v-if="list" @click="$p.navto(`/pages/my/add_address?type=1&name=${list.name}&mobile=${list.mobile}&province=${list.province}&city=${list.city}&area=${list.area}&address=${list.address}`)">
					<view class="left">
						<p>
							<text>{{list.name}}</text>
							<text>{{list.mobile}}</text>
						</p>
						<p>{{list.province}} {{list.city}} {{list.area}} {{list.address}}</p>
					</view>
					<u-icon class="arrow_r" name="arrow-right" color="#000" size="20px"></u-icon>
				</view>
			</view>

			<view v-if="!list">
				<view class="button" @click="$p.navto('/pages/forest/add_address')">
					添加收货地址
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:'',
			};
		},
		onShow(){
			this.receiveAddr2();
		},
		methods: {
			async receiveAddr2(){
				let res = await this.$http.index.receiveAddr2();
				this.list = res.data
			},
		},
	}
</script>

<style lang="less">

.zone {
	background: linear-gradient(180deg, #0477FD 0%, #7AFDCF 100%);
	min-height: 100vh;
}
.main {
	padding: 10px;
}

.item {
	padding: 10px;
	background: #FFFFFF;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: space-between;

	.left {
		flex: 1;

		p:nth-child(1) {
			color: #000000;
			font-size: 14px;
			font-weight: 600;

			text:nth-child(2) {
				margin-left: 10px;
			}
		}
		p:nth-child(2) {
			margin-top: 10px;
			color: #343434;
			font-size: 12px;
		}
	}

}


.button {
	width: 90%;
	margin: 10px auto;
	background: url('http://img.cpgm.cc/panda/static/public/btn3.png');
	background-size: 100% 100%;
	height: 60px;
	color: #B73800;
	font-size: 20px;
	font-weight: 600;
}

// 数据为空
.empty {
	width: 100%;
	padding: 10vh 10px 10px;
	display: flex;
	align-items: center;
	flex-direction: column;
	justify-content: center;

	image {
		width: 60%;
	}
	text {
		color: rgba(52, 52, 52, 0.71);
		font-weight: 600;
	}
}

</style>
